using System;

namespace RPGLibrary.ItemClasses
{
    public class Armor : BaseItem
    {
        public ArmorLocation Location{get; protected set;}
        public int DefenseValue { get; protected set; }
        public int DefenseModifier { get; protected set; }

        public Armor(
            string armorName,
            string armorType,
            int price,
            float weight,
            ArmorLocation location,
            int defenseValue,
            int defenseModifier,
            params string[] allowableClasses)
            : base(armorName, armorType, price, weight, allowableClasses)
        {
            Location = location;
            DefenseValue = defenseValue;
            DefenseModifier = defenseModifier;
        }

        public override object Clone()
        {
            string[] allowedClasses = new string[allowableClasses.Count];

            for (int i = 0; i < allowableClasses.Count; i++)
            {
                allowedClasses[i] = allowableClasses[i];
            }

            Armor armor = new Armor(
                Name,
                Type, 
                Price,
                Weight,
                Location,
                DefenseValue,
                DefenseModifier,
                allowedClasses);

            return armor;
        }

        public override string ToString()
        {
            string armorString = base.ToString() + ", ";
            armorString += Location + ", ";
            armorString += DefenseValue + ", ";
            armorString += DefenseModifier.ToString();

            foreach (string s in allowableClasses)
            {
                armorString += ", " + s;
            }

            return armorString;
        }
    }
}